import React, { memo } from 'react'
import { SwitchTransition, CSSTransition } from 'react-transition-group'
import './index.scss'

const AnimatedSwitch = ({ animateKey = '', children }) => {
  return<SwitchTransition mode="out-in">
    <CSSTransition key={animateKey} timeout={300} classNames="fade">{children}</CSSTransition>
  </SwitchTransition>
}

export default memo(AnimatedSwitch)